using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using NHibernate.Criterion;

using QLTDK.Entities;
using QLTDK.DataAccess.Interfaces.BaseInterfaces;
using QLTDK.DataAccess.Base;

namespace QLTDK.DataAccess.BaseDaos
{
    public class BaseTdCaydenDao : NHibernateDao<TdCayden, int>, IBaseTdCaydenDao
    {
		#region Constructors
		
		public BaseTdCaydenDao() : base()
        {
        }
		
		#endregion
		
        #region Get Methods

		
		public IList<TdCayden> GetByMaTruDen(System.Int32 maTruDen)
        {
			return HibernateTemplate.ExecuteFind<TdCayden>(

			    delegate(ISession session)
				{
					ICriteria criteria = session.CreateCriteria(typeof(TdCayden));
					
					
					ICriteria maTruDenCriteria = criteria.CreateCriteria("MaTruDen");
					maTruDenCriteria.Add(Expression.Eq("Id", maTruDen));
					
					return criteria.List<TdCayden>();
				});
        }
		
		public IList<TdCayden> GetByMaTuyenDen(System.Int32 maTuyenDen)
        {
			return HibernateTemplate.ExecuteFind<TdCayden>(

			    delegate(ISession session)
				{
					ICriteria criteria = session.CreateCriteria(typeof(TdCayden));
					
					
					ICriteria maTuyenDenCriteria = criteria.CreateCriteria("MaTuyenDen");
					maTuyenDenCriteria.Add(Expression.Eq("Id", maTuyenDen));
					
					return criteria.List<TdCayden>();
				});
        }
		
		#endregion
    }
}